package com.example.utils;

import com.example.model.CargoRequest;

public class CargRequestData {
    //验证上传的数据是否有错误
    public static boolean isValidCargoRequest(CargoRequest cargoRequest) {
        // 验证货物类别名称是否为空
        if (cargoRequest.getCargoCategory() == null || cargoRequest.getCargoCategory().isEmpty()) {
            return false;
        }
        // 验证载具总重量是否为空且大于0
        else if (cargoRequest.getVehicleWeight() == null || cargoRequest.getVehicleWeight() <= 0) {
            return false;
        }
        // 验证货物宽度是否为空且大于0
        else if (cargoRequest.getCargoWidth() == null || cargoRequest.getCargoWidth() <= 0) {
            return false;
        }
        // 验证货物长度是否为空且大于0
        else if (cargoRequest.getCargoLength() == null || cargoRequest.getCargoLength() <= 0) {
            return false;
        }
        // 验证货物高度是否为空且大于0
        else if (cargoRequest.getCargoHeight() == null || cargoRequest.getCargoHeight() <= 0) {
            return false;
        }
        else return true;

    }
}
